<template>
  <div>
    <div class="set-item">
      <div class="tit">当前设置城市</div>
      <div class="it">{{city}}</div>
    </div>
    <div class="set-item">
      <div class="tit">更换城市</div>
      <div class="it">
        <AreaSelect @change="onChange"/>
      </div>
    </div>
    <ColorSet @change="onChangeColor" :c="currActiveItem.color" title="字体颜色"/>
  </div>
</template>

<script>
import dataApi from '@/view/data-api-edit'
import AreaSelect from '@/view/comm/area-select'
import ColorSet from '@/view/SetItems/ColorSet'
export default {
  components: {
    AreaSelect,
    ColorSet
  },
  data () {
    return {
      themeText: '',
      datetime: '',
      notBefore: ''
    }
  },
  computed: {
    city () {
      let city = dataApi.currActiveItem.city
      let arr = city.split(',')
      let province = arr[0]
      if (province === arr[1]) {
        let county = arr[2]
        if (county) {
          return province + ',' + county
        }
        return province
      }
      return city
    },
    currActiveItem () {
      return dataApi.currActiveItem
    }
  },
  methods: {
    onChange ({ selectedValue }) {
      if (selectedValue.length > 1) dataApi.currActiveItem.city = selectedValue.join(',')
    },
    onChangeColor (v) {
      dataApi.currActiveItem.color = v
    }
  }
}
</script>

<style scoped>
.del-ico {
  width: 20px;
  height: 20px;
  margin-right: 4px;
  color: #f52f2f;
}
.add-ico {
  width: 20px;
  height: 20px;
  margin-right: 4px;
  color: #00b7ee;
  vertical-align: -5px;
}
.v-list {
  list-style-type: none;
  padding: 0;
  margin: 0;
}
.v-item {
  white-space: nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.del {
  vertical-align: -5px;
}
.n {
  vertical-align: middle;
}
</style>
